---击退
---* [0] 击退速度
---* [1] 击退距离(像素)
---* [2] 是否可以击退出边界
---@class BuffEffect2:BaseBuffEffect
BuffEffect2 = ClientFight.CreateClass("BuffEffect2",ClientFight.BaseBuffEffect)
local t = BuffEffect2

---@param fight Fighter
---@param buff FighterBuff
function t:add(fight, buff,useAttribute)
    SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff"
    .. buff.modelId .. " 增加击退BUFF效果");

    return ClientFight.BaseBuffEffect.add(self,fight, buff);

end
---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = {...}
    if (buff.target:isDie()) then
        return IBuffEffect.SUCCESS_ATTRI_HAS_CHANGE;
    end

    local back = 0;
    if (buff.buffBean.f_BuffEffectValue[1] > 0) then
        back = buff.buffBean.f_BuffEffectValue[1] / Global.FIGHT_FRAME;
    elseif (buff.buffBean.f_BuffEffectValue[2] > 0) then
        if (buff.continuedTime > 0 and buff.buffBean.f_BuffTime > 0) then
            back = buff.buffBean.f_BuffEffectValue[2] / (buff.continuedTime * 1.0 / buff.buffBean.f_BuffTime);
        else
            back = buff.buffBean.f_BuffEffectValue[2]
        end
    end

    -- 被击者后退
    local x = buff.target.position.x
    + ( buff.addParameters[2]).targetDirection * back / Global.TEN_THOUSANDTH;
    local out = FighterManager.changePosition(fight, buff.target, 0, x, buff.target.position.y, 0, true, true, true);

    --这里不加入战报  客户端更具特效自己移动位置 只针对击退效果
    --fight.getActions().add(FightReportManager.changePointToJsonString(fight, buff.target, 0, null));
    SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff"
    .. buff.modelId .. " 击退到" .. getJsonStr(buff.target.position) );


    if (out) then
    --           return IBuffEffect.REMOVE;
    end

    return ClientFight.BaseBuffEffect.action(self,fight, buff, parameters);
end
t.New()